package cn.ctyun.videoplayer.bean;


public class M3u8PlayList {
    private String url;
    private int bandWidth;
    private int resolution;
    private String name;

    public M3u8PlayList(String url, int bandWidth, int resolution, String name){
        this.url = url;
        this.bandWidth = bandWidth;
        this.resolution = resolution;
        this.name = name;
    }
    public void setUrl(String url){
        this.url = url;
    }

    public void setBandWidth(int bandWidth){
        this.bandWidth = bandWidth;
    }

    public void setResolution(int resolution){
        this.resolution = resolution;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public int getBandWidth() {
        return this.bandWidth;
    }

    public int getResolution() {
        return this.resolution;
    }

    public String getUrl() {
        return this.url;
    }

    public String getUrlName(){
        String urlName;
        if (this.name != null){
            urlName = this.name;
        } else {
            if (this.resolution!= -1){
                urlName = this.resolution + "P";
            } else {
                int kb = this.bandWidth / 1024;
                if (kb < 1){
                    urlName = this.bandWidth + "bit";
                } else {
                    int mb = kb / 1024;
                    if (mb < 1) {
                        urlName = kb + "Kb";
                    }else{
                        urlName = mb + "Mb";
                    }
                }
            }
        }
        return urlName;
    }
}
